using WXWorkSvc.Common.Models;

namespace WXWorkSvc.Private.Areas.Pages.Setup.User;


public class IndexModel : PageModel
{
    public List<TPrivateUser> Items { get; set; } = default!;
    public async Task OnGet([FromServices] WXDbContext db, [FromServices] WXWorkConfig config, [FromServices] IRole role)
    {
        Items = await db.PrivateUsers.Where(ii => ii.AgentId == config.AgentId).ToListAsync();
        foreach (var item in Items)
        {
            item.RoleNames = role.GetRoleNames(item.Roles);
        }

    }
}
